{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>投票系统</title>
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
    <!-- 悬浮框架 -->
    <div class="floating-frame">
        <h1><i class="fas fa-vote-yea"></i> 投票系统</h1>
        <div class="stats-container">
            <div class="stat-item">
                <i class="fas fa-poll icon"></i>
                <span>投票主题: {{ total_questions }}</span>
            </div>
            <div class="stat-item">
                <i class="fas fa-users icon"></i>
                <span>总投票数: {{ total_votes }}</span>
            </div>
            <div class="stat-item">
                <i class="fas fa-check-circle icon"></i>
                <span>选项总数: {{ total_choices }}</span>
            </div>
        </div>
    </div>

    <header>
        <h1>投票系统</h1>
        <a href="../admin" class="btn"><i class="fas fa-cog"></i> 后台管理</a>
    </header>

    <main>
        <h2><i class="fas fa-list"></i> 请选择投票主题：</h2>
        
        {% if latest_question_list %}
            <ul>
            {% for question in latest_question_list %}
                <li>
                    <a href="{% url 'polls:detail' question.id %}">
                        <i class="fas fa-question-circle"></i> {{ question.question_text }}
                    </a>
                    <span class="vote-count">(已有 {{ question.total_votes }} 票)</span>
                </li>
            {% endfor %}
            </ul>
        {% else %}
            <p>暂无投票主题</p>
        {% endif %}
    </main>

    <footer>
        <p>© 2023 投票系统 | 使用Django构建</p>
    </footer>
</body>
</html>